import request from '../http/axios'
//新增试验记录
export function createRecord(data) {
  return request({
    url: '/api/exp-records',
    method: 'POST',
    data,
  })
}

//获取试验记录
export function getRecords(data) {
  return request({
    url: '/api/exp-records',
    method: 'get',
    params: data,
  })
}
export function getExpRecordById(id) {
  return request({
    url: 'api/exp-records/' + id,
    method: 'get',
  })
}
//删除实验记录
export function deleteExpRecord(id) {
  return request({
    url: 'api/exp-records/' + id,
    method: 'DELETE',
  })
}
//更新实验记录
export function updateExpRecord(data) {
  return request({
    url: 'api/update-exp-record',
    method: 'post',
    data,
  })
}

//检查模块
export function getCheck(data) {
  return request({
    url: '/api/module/check',
    method: 'get',
    params: data,
  })
}
//获取模块列表
export function getModuleList(data) {
  return request({
    url: '/api/module-list',
    method: 'get',
    params: data,
  })
}
//更新实验记录
export function positionMatch(data) {
  return request({
    url: 'api/position-match',
    method: 'post',
    data,
  })
}

//启动点火
export function ignition(data) {
  return request({
    url: 'api/modules/ignition',
    method: 'post',
    data,
  })
}
//启动视频流
export function startVideo(data) {
  return request({
    url: 'api/start-video-stream',
    method: 'post',
    data,
  })
}
//停止视频流
export function stopVideo(data) {
  return request({
    url: 'api/stop-video-stream',
    method: 'post',
    data,
  })
}
//切圆识别
export function circularPatternRecognition(data) {
  return request({
    url: 'api/video/circular_pattern',
    method: 'post',
    data,
  })
}

//批量执行圆形图案识别并返回快照和风车图
export function circularPatternExport(data) {
  return request({
    url: 'api/video/circular_pattern/export',
    method: 'post',
    data,
  })
}

//获取workerid
export function getWorkerId(data) {
  return request({
    url: 'api/video/circular_pattern/realtime/start',
    method: 'post',
    data,
  })
}
//停止切圆识别
export function stopRealtime(data) {
  return request({
    url: 'api/video/circular_pattern/realtime/stop',
    method: 'post',
    data,
  })
}
//初始化本次试验的模块分配(按location分组)
export function recordIdInit(recordId) {
  return request({
    url: `/api/modules/layout/${recordId}/init`,
    method: 'post',
  })
}
//获取指定位置的模块布局
export function getLocation(recordId, location) {
  return request({
    url: `/api/modules/layout/${recordId}/layers/${location}`,
    method: 'get',
  })
}
//同一位置互换两个模块的相对顺序
export function setModeOrder(recordId, data) {
  return request({
    url: `/api/modules/layout/${recordId}/swap`,
    method: 'put',
    data,
  })
}
